package Builder;

/**
 * <p>Title TextBuilder</p>
 *
 * @author YiMing Liu
 * @date 2018/6/11 17:02
 * <p>Description:</p>
 */
public class TextBuilder extends Builder {
    private StringBuffer buffer = new StringBuffer();

    @Override
    public void makeTitle(String title) {
        buffer.append("-------------"+"\n");
        buffer.append("[" + title + "]");
        buffer.append("\n");
    }

    @Override
    public void makeContent(String content) {
        buffer.append("~" + content + "\n");
    }

    @Override
    public void makeItems(String[] items) {
        for (int i = 0; i < items.length; i++) {
            buffer.append("." + items[i] + "\n");
        }
        buffer.append("\n");
    }

    @Override
    public void close() {
        buffer.append("----------");
    }
    public String getString(){
        return buffer.toString();
    }
}
